#!/bin/sh

if [ $# -ne 1 ]; then 
	echo "usage: $0 mdfile"
	exit -1
fi

awk '{printf $0 "XXXX"}' $1 |sed -e "s/XXXX#### /XXXX\n#### /g" |sed -e "s/^/echo \"/g" |sed -e "s/$/\" > /g" >$1.1 ;echo "" >>$1.1

mv $1.1 >$1

line=`wc $1 | awk '{print $1}'`

no $line >no 

sed -e "s/$/\.md/g" no >no.1

mv no.1 no 

paste $1 no >f.sh

sh f.sh
